{extend name="common/base" /}
{block name="title"}添加管理员{/block}
<body>
<div id="wrapper">
     <!-- Navigation -->
       {block name="main"} 
	   <div class="copyrights">Collect from <a href="http://www.cssmoban.com/" >网页模板</a></div>
	   <div id="page-wrapper">
        <div class="col-md-12 graphs">
		<div class="xs">
  	    <h3>添加管理员</h3>
  	    <div class="well1 white">
        <form class="form-floating ng-pristine ng-invalid ng-invalid-required ng-valid-email ng-valid-url ng-valid-pattern" novalidate="novalidate" ng-submit="submit()" action="{:url('Administrator/doManagersAdd')}" method = 'post' enctype="multipart/form-data">
          <fieldset>
            <div class="form-group">
              <label class="control-label">姓名</label>
              <input name="name" type="text" class="form-control1" ng-model="model.name" value="{$res['name']?$res['name']:''}" required="" >
			  <input name="id" type="hidden" value="{$res['id']?$res['id']:''}" required="" >
            </div>
            <div class="form-group">
              <label class="control-label">密码</label>
              <input name="password" type="password" class="form-control1" ng-model="model.password" value="{$res['password']?$res['password']:''}" required="">
            </div>
            <div class="form-group filled">
              <label class="control-label">权限</label>
              <select class="form-control1 ng-invalid ng-invalid-required" ng-model="model.select" required="" name="position">
                <option value="0" {$res["position"]?"":"selected"}>超级管理员</option>
                <option value="1" {$res["position"]?"selected":""}>管理员</option>
              </select>
            </div>
			<div class="form-group">
              <label class="control-label">头像</label>
              <input name="photo" type="file" ng-model="model.file" required="" id="exampleInputFile">
			    <input name="photo" type="hidden" value="{$res['photo']?$res['photo']:''}">
			<!-- 显示图片的地方 -->
			<div id="destination" style="margin-top:10px;">
			<img src="{$res['photo']?$res['photo']:''}" style="width:100px;"></div>

            </div>
            <div class="form-group">
              <button type="submit" class="btn btn-primary">提交</button>
              <button type="reset" class="btn btn-default">重置</button>
            </div>
          </fieldset>
        </form>
      </div>
    </div>
	    <script type="text/javascript">
			document.getElementById('exampleInputFile').addEventListener('change', function() {
				var file;
				var destination = document.getElementById('destination');
				destination.innerHTML = '';

				// 循环用户多选的文件
				for(var x = 0, xlen = this.files.length; x < xlen; x++) {
					file = this.files[x];
					if(file.type.indexOf('image') != -1) { // 非常简单的交验

						var reader = new FileReader();

						reader.onload = function(e) {
							var img = new Image();
							img.src = e.target.result; // 显示图片的地方
							img.width = 100;
							destination.appendChild(img);
						};

						reader.readAsDataURL(file);
					}
				}
			});
				//隐藏提示消息
				window.onload = function(){



				setInterval(function(){
					$("#jg").fadeOut(1000);
				}, 3000);
				}
		</script>
		
		
		{/block}

  
    
